import { Switch, SwitchProps, Form } from "antd"
interface SwtichBarProps extends SwitchProps {
  label?: string
  value?: boolean
  fieldName?: string
  wrapperStyle?: React.CSSProperties
}
export function SwitchBar({
  label,
  value,
  fieldName = "switch",
  wrapperStyle,
  ...props
}: SwtichBarProps) {
  return (
    <div
      style={{
        display: "flex",
        justifyContent: "space-between",
        alignItems: "center",
        ...wrapperStyle
      }}
    >
      {label}
      <Form.Item noStyle name={fieldName}>
        <Switch checked={value} {...props}></Switch>
      </Form.Item>
    </div>
  )
}
